package com.example.webchar.webchar.config;

import com.example.webchar.webchar.pojo.Users;
import com.example.webchar.webchar.service.CrawlService;
import com.example.webchar.webchar.utils.MailUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;

/**
 * rabbtimq监听信息
 *
 * @program: webchars
 * @description
 * @author: 毛叶贵子
 * @create: 2021-08-27 11:17
 **/
@Component
@Slf4j
@RabbitListener(queues = "novel")
public class RabbitMqListener {
    @Autowired
    private CrawlService crawlService;

    @RabbitHandler

    public void process(HashMap<String, String> hashMap) {
        try {
            crawlService.novelCrawl(hashMap.get("name"), hashMap.get("email"));
        } catch (Exception e) {
            log.info("err");
        }

    }

}
